package com.example.my.agiftthat.ui.home.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.example.my.agiftthat.R;
import com.example.my.agiftthat.helper.RecyclerViewAdapterHelper;
import com.example.my.agiftthat.ui.home.bean.SixBean;

import java.util.List;

/**
 * Created by My on 2016/12/21.
 */

public class SixRecyclerAdapter extends RecyclerViewAdapterHelper<SixBean.DataBean.SecondaryBannersBean>{
    public SixRecyclerAdapter(Context context, List<SixBean.DataBean.SecondaryBannersBean> list) {
        super(context, list);
    }

    @Override
    public RecyclerView.ViewHolder onCreateMyViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(context).inflate(R.layout.item_selector_six,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindMyViewHolder(RecyclerView.ViewHolder holder, int position) {
        if(holder instanceof ViewHolder){
            Glide.with(context).load(list.get(position).getImage_url()).into(((ViewHolder) holder).imageView_six);
        }
    }
    class ViewHolder extends RecyclerView.ViewHolder{
        private ImageView imageView_six;
        public ViewHolder(View itemView) {
            super(itemView);
            imageView_six= (ImageView) itemView.findViewById(R.id.imageView_six);
        }
    }
}
